@mixin clearfix {
    &:after {
        content: ".";
        display: block;
        clear: both;
        visibility: hidden;
        height: 0;
        font-size: 0;
    }
}

// Dom-scrollBar
@mixin scrollBar($color, $width) {
    &::-webkit-scrollbar-track-piece {
        background-color: $color !important;
    }

    &::-webkit-scrollbar {
        width: $width !important;
    }

    &::-webkit-scrollbar-thumb {
        background-color: $color !important;
        border-radius: 20px;
    }
}

//全局scrollBar
@mixin globalScrollBar {
    :-webkit-autofill {
        -webkit-box-shadow: 0 0 0 1000px white inset;
    }

    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
        background-color: transparent;
    }

    ::-webkit-scrollbar:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }

    ::-webkit-scrollbar-thumb {
        background: rgba(15, 15, 15, 0.3);
        border-radius: 100px;
        background-clip: padding-box;
        border: 1px solid transparent;
        min-height: 10px;
    }

    ::-webkit-scrollbar-thumb:active {
        background: rgba(11, 11, 11, 0.4);
        -webkit-border-radius: 100px;
    }
}

@mixin relative {
    position: relative;
    width: 100%;
    height: 100%;
}

@mixin pct($pct) {
    width: #{$pct};
    position: relative;
    margin: 0 auto;
}

@mixin triangle($width, $height, $color, $direction) {
    $width: $width/2;
    $color-border-style: $height solid $color;
    $transparent-border-style: $width solid transparent;
    height: 0;
    width: 0;

    @if $direction==up {
        border-bottom: $color-border-style;
        border-left: $transparent-border-style;
        border-right: $transparent-border-style;
    } @else if $direction==right {
        border-left: $color-border-style;
        border-top: $transparent-border-style;
        border-bottom: $transparent-border-style;
    } @else if $direction==down {
        border-top: $color-border-style;
        border-left: $transparent-border-style;
        border-right: $transparent-border-style;
    } @else if $direction==left {
        border-right: $color-border-style;
        border-top: $transparent-border-style;
        border-bottom: $transparent-border-style;
    }
}

@mixin background($url, $left: left, $top: top, $width: 100%, $height: 100%) {
    background-image: url("@/assets/img/"+$url+".png");
    background-size: $width $height;
    background-position: $left $top;
    background-repeat: no-repeat;
    text-overflow: ellipsis;
}
@mixin ellipsis($maxw) {
    width: auto !important;
    max-width: $maxw !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

@mixin lineClamp($line) {
    display: -webkit-box;
    /*! autoprefixer: off */
    -webkit-line-clamp: $line;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-box-orient: vertical;
}

@mixin colorBtn($color) {
    background: $color;

    &:hover {
        color: $color;

        &:before,
        &:after {
            background: $color;
        }
    }
}

// 设置渐变色
@mixin setGradient {
    border-bottom: solid 1px;
    border-image: -webkit-linear-gradient(
            -180deg,
            rgba(255, 255, 255, 0) 0%,
            #dedede 50%,
            rgba(255, 255, 255, 0) 99%
        )
        2 2 2 2;
}

//placeholder设置
@mixin setPlaceholder($color: #cdcdcd, $fontSize: 14px) {
    // input placeholder 文字颜色
    input:-ms-input-placeholder {
        /* WebKit browsers */
        color: $color !important;
        font-size: $fontSize;
    }

    input::-webkit-input-placeholder {
        /* WebKit browsers */
        color: $color !important;
        font-size: $fontSize;
    }

    input::-moz-placeholder {
        /* WebKit browsers */
        color: $color !important;
        font-size: $fontSize;
    }

    input:-moz-placeholder {
        /* WebKit browsers */
        color: $color !important;
        font-size: $fontSize;
    }
}
